package org.jeecg.modules.rooms.service;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.business.entity.BusMarketMember;
import org.jeecg.modules.business.service.impl.BusMarketMemberServiceImpl;
import org.jeecg.modules.rooms.Vo.LayoutMemberPriceVo;
import org.jeecg.modules.rooms.entity.CesRoomLayoutMemberPrice;
import org.jeecg.modules.rooms.mapper.CesRoomLayoutMemberPriceMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

/**
 * <p>
 * 房型会员价格 记录表 服务实现类
 * </p>
 *
 * @author fendo
 * @since 2023-03-06
 */
@Service
public class CesRoomLayoutMemberPriceServiceImpl extends ServiceImpl<CesRoomLayoutMemberPriceMapper, CesRoomLayoutMemberPrice> implements IService<CesRoomLayoutMemberPrice> {

    @Resource
    private CesRoomLayoutMemberPriceMapper cesRoomLayoutMemberPriceMapper;

    @Resource
    private BusMarketMemberServiceImpl marketMemberService;


    /**
     * 获取会员等级数据
     * @param parentId`
     * @return
     */
    public List<CesRoomLayoutMemberPrice> getListByParentId(String parentId){
        if(StringUtils.isBlank(parentId)) return new ArrayList<>();
        List<CesRoomLayoutMemberPrice> list = cesRoomLayoutMemberPriceMapper.selectList(Wrappers.<CesRoomLayoutMemberPrice>lambdaQuery()
                .eq(CesRoomLayoutMemberPrice::getParentId,parentId)
                .eq(CesRoomLayoutMemberPrice::getInvalid,false));

        return list;
    }
}
